package com.mz.ozy.activity.me;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.mz.ozy.R;
import com.mz.ozy.adapter.LogisticsListAdapter;
import com.mz.ozy.base.BaseActivity;
import com.mz.ozy.bean.AssetsBean;
import com.mz.ozy.bean.MyOrderInfoBean1;
import com.mz.ozy.bean.NetBean;
import com.mz.ozy.mvp.presenter.MyOrderInfoPresenter1;
import com.mz.ozy.mvp.view.MyOrderInfoContract1;

import org.json.JSONObject;

import java.util.List;

import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;

public class LogisticsActivity extends BaseActivity<MyOrderInfoContract1.View, MyOrderInfoPresenter1> implements MyOrderInfoContract1.View {

    private LogisticsListAdapter mAdapter;
    @BindView(R.id.rv_goods)
    RecyclerView mRvGoods;
    @BindView(R.id.nsv_scroll_view)
    NestedScrollView mNsvScrollView;
    private String mOrder;
    private String mAddress;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_logistics);
        ButterKnife.bind(this);
        initTitle();
        mAddress = getIntent().getStringExtra("address");
        mOrder = getIntent().getStringExtra("order");
        mPresenter.initData(this, mOrder, 0);
        init();
    }

    private void init() {
        tvCenterTitle.setText("物流信息");
        mRvGoods.setLayoutManager(new LinearLayoutManager(this));
        mAdapter = new LogisticsListAdapter(this,null,mOrder,mAddress);
        mRvGoods.setAdapter(mAdapter);
        mRvGoods.setNestedScrollingEnabled(false);
    }

    @Override
    public void onInitSuccess(MyOrderInfoBean1 myOrderInfoBean) {
        mNsvScrollView.setVisibility(View.VISIBLE);
        final List<MyOrderInfoBean1.OrdermapBean.ProdcutListBean> prodcut_list = myOrderInfoBean.getOrdermap().getProdcut_list();
        mAdapter.setNewData(prodcut_list);
        mAdapter.notifyDataSetChanged();
    }

    @Override
    public void onInitError(String msg) {

    }

    @Override
    public void onConfirmSuccess(NetBean netBean) {

    }

    @Override
    public void onConfirmError(String msg) {

    }

    @Override
    public void onCancelOrderSuccess(NetBean netBean) {

    }

    @Override
    public void onCancelOrderError(String msg) {

    }

    @Override
    public void onDelOrderSuccess(NetBean netBean) {

    }

    @Override
    public void onDelOrderError(String msg) {

    }

    @Override
    public void geAssetsInfoSuccess(AssetsBean bean) {

    }

    @Override
    public void onPaySuccess(JSONObject orderBean) {

    }

    @Override
    public void onPayError(String s) {

    }
}